home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume22 / undel2 / part01 next >
Encoding:
Internet Message Format  |  1990-06-07  |  56.4 KB

  1. Subject:  v22i025:  MIT Athena delete/undelete programs, release 2, Part01/03
  2. Newsgroups: comp.sources.unix
  3. Approved: rsalz@uunet.UU.NET
  4. X-Checksum-Snefru: 595a9f60 8a64bdca e9307896 eac15f1c
  5.  
  6. Submitted-by: "Jonathan I. Kamens" <jik@pit-manager.mit.edu>
  7. Posting-number: Volume 22, Issue 25
  8. Archive-name: undel2/part01
  9.  
  10. Delete marks files and directories for later permanent removal (by
  11. renaming them with a prefix of ".#").  Files accidentally marked for
  12. deletion can be recovered using undelete(1).  Marked files are
  13. periodically removed automatically by the system; they can also be removed
  14. on demand (see purge(1) and expunge(1) for details).  Users can list files
  15. which have been marked for removal but have not yet been removed using
  16. lsdel(1).
  17.  
  18. #! /bin/sh
  19. # This is a shell archive.  Remove anything before this line, then unpack
  20. # it by saving it into a file and typing "sh file".  To overwrite existing
  21. # files, type "sh file -c".  You can also feed this as standard input via
  22. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  23. # will see the following message at the end:
  24. #        "End of archive 1 (of 3)."
  25. # Contents:  MANIFEST Makefile PATCHLEVEL README col.h delete.h
  26. #   delete_errs.et directories.h errors.c errors.h expunge.h lsdel.h
  27. #   man1 man1/delete.1 man1/expunge.1 man1/lsdel.1 man1/purge.1
  28. #   man1/undelete.1 mit-copyright.h pattern.h shell_regexp.c
  29. #   shell_regexp.h stack.c stack.h undelete.h util.h
  30. # Wrapped by rsalz@papaya.bbn.com on Mon May  7 16:53:57 1990
  31. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  32. if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  33.   echo shar: Will not clobber existing file \"'MANIFEST'\"
  34. else
  35. echo shar: Extracting \"'MANIFEST'\" \(1150 characters\)
  36. sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
  37. X   File Name        Archive #    Description
  38. X-----------------------------------------------------------
  39. X MANIFEST                   1    
  40. X Makefile                   1    
  41. X PATCHLEVEL                 1    
  42. X README                     1    
  43. X col.c                      2    
  44. X col.h                      1    
  45. X delete.c                   3    
  46. X delete.h                   1    
  47. X delete_errs.et             1    
  48. X directories.c              3    
  49. X directories.h              1    
  50. X errors.c                   1    
  51. X errors.h                   1    
  52. X expunge.c                  2    
  53. X expunge.h                  1    
  54. X lsdel.c                    2    
  55. X lsdel.h                    1    
  56. X man1                       1    
  57. X man1/delete.1              1    
  58. X man1/expunge.1             1    
  59. X man1/lsdel.1               1    
  60. X man1/purge.1               1    
  61. X man1/undelete.1            1    
  62. X mit-copyright.h            1    
  63. X pattern.c                  3    
  64. X pattern.h                  1    
  65. X shell_regexp.c             1    
  66. X shell_regexp.h             1    
  67. X stack.c                    1    
  68. X stack.h                    1    
  69. X undelete.c                 2    
  70. X undelete.h                 1    
  71. X util.c                     2    
  72. X util.h                     1    
  73. END_OF_FILE
  74. if test 1150 -ne `wc -c <'MANIFEST'`; then
  75.     echo shar: \"'MANIFEST'\" unpacked with wrong size!
  76. fi
  77. # end of 'MANIFEST'
  78. fi
  79. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  80.   echo shar: Will not clobber existing file \"'Makefile'\"
  81. else
  82. echo shar: Extracting \"'Makefile'\" \(4803 characters\)
  83. sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  84. X#     Copyright 1988 Massachusetts Institute of Technology.
  85. X#
  86. X#     For copying and distribution information, see the file
  87. X#     "mit-copyright.h".
  88. X#
  89. X#     $Source: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/Makefile,v $
  90. X#     $Author: jik $
  91. X#     $Header: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/Makefile,v 1.17 89/12/20 15:14:34 jik Exp $
  92. X#
  93. X
  94. XDESTDIR=
  95. XTARGETS=     delete undelete expunge purge lsdel
  96. XINSTALLDIR=     /bin/athena
  97. XMANDIR=        /usr/man
  98. XMANSECT=    1
  99. XCC=         cc
  100. XCOMPILE_ET=     compile_et
  101. XLINT=         lint
  102. XDEFINES=    -DAFS_MOUNTPOINTS
  103. XINCLUDES=    -I/usr/include\
  104. X        -I/afs/athena.mit.edu/astaff/project/afsdev/build/$(MACHINE)/include
  105. XCFLAGS=     -O $(INCLUDES) $(DEFINES) $(CDEBUGFLAGS)
  106. XLDFLAGS=    -L/usr/athena/lib\
  107. X        -L/afs/athena.mit.edu/astaff/project/afsdev/build/$(MACHINE)/lib/afs
  108. XLIBS=         -lcom_err -lsys
  109. XLINTFLAGS=    $(DEFINES) $(INCLUDES) $(CDEBUGFLAGS) -u
  110. XLINTLIBS=    
  111. XSRCS=         delete.c undelete.c directories.c pattern.c util.c\
  112. X        expunge.c lsdel.c col.c shell_regexp.c\
  113. X        errors.c stack.c
  114. XINCS=         col.h delete.h directories.h expunge.h lsdel.h\
  115. X        mit-copyright.h pattern.h undelete.h util.h\
  116. X        shell_regexp.h errors.h stack.h
  117. XETS=        delete_errs.h delete_errs.c
  118. XETSRCS=        delete_errs.et
  119. X
  120. XMANS=         man1/delete.1 man1/expunge.1 man1/lsdel.1 man1/purge.1\
  121. X        man1/undelete.1
  122. X
  123. XETLIBSRCS=    et/Makefile et/com_err.3 et/compile_et.1\
  124. X        et/com_err.texinfo.Z.uu et/error_table.y et/et_lex.lex.l\
  125. X        et/texinfo.tex.Z.uu et/*.c et/*.h et/*.et
  126. XARCHIVE=    README Makefile PATCHLEVEL $(SRCS) $(INCS) $(ETSRCS)\
  127. X        $(MANS) 
  128. XARCHIVEDIRS=     man1 et et/profiled
  129. X
  130. XDELETEOBJS=     delete.o util.o delete_errs.o errors.o
  131. XUNDELETEOBJS=     undelete.o directories.o util.o pattern.o\
  132. X        shell_regexp.o delete_errs.o errors.o stack.o
  133. XEXPUNGEOBJS=     expunge.o directories.o pattern.o util.o col.o\
  134. X        shell_regexp.o delete_errs.o errors.o stack.o
  135. XLSDELOBJS=     lsdel.o util.o directories.o pattern.o col.o\
  136. X        shell_regexp.o delete_errs.o errors.o stack.o
  137. X
  138. XDELETESRC=     delete.c util.c delete_errs.c errors.c
  139. XUNDELETESRC=     undelete.c directories.c util.c pattern.c\
  140. X        shell_regexp.c delete_errs.c errors.c stack.c
  141. XEXPUNGESRC=     expunge.c directories.c pattern.c util.c col.c\
  142. X        shell_regexp.c delete_errs.c errors.c stack.c
  143. XLSDELSRC=     lsdel.c util.c directories.c pattern.c col.c\
  144. X        shell_regexp.c delete_errs.c errors.c stack.c
  145. X
  146. X.SUFFIXES: .c .h .et
  147. X
  148. X.et.h: $*.et
  149. X    ${COMPILE_ET} $*.et
  150. X.et.c: $*.et
  151. X    ${COMPILE_ET} $*.et
  152. X
  153. Xall: $(TARGETS)
  154. X
  155. Xlint_all: lint_delete lint_undelete lint_expunge lint_lsdel
  156. X
  157. Xinstall: bin_install man_install
  158. X
  159. X# Errors are ignored on bin_install and man_install because make on
  160. X# some platforms, in combination with the shell, does really stupid
  161. X# things and detects an error where there is none.
  162. X
  163. Xman_install:
  164. X    -for i in $(TARGETS) ; do\
  165. X      install -c man1/$$i.1\
  166. X        $(DESTDIR)$(MANDIR)/man$(MANSECT)/$$i.$(MANSECT);\
  167. X    done
  168. X
  169. Xbin_install: $(TARGETS)
  170. X    -for i in $(TARGETS) ; do\
  171. X          if [ -f $(DESTDIR)$(INSTALLDIR)/$$i ]; then\
  172. X            mv $(DESTDIR)$(INSTALLDIR)/$$i $(DESTDIR)$(INSTALLDIR)/.#$$i ; \
  173. X          fi; \
  174. X      install -c -s $$i $(DESTDIR)$(INSTALLDIR) ; \
  175. X        done
  176. X
  177. Xdelete: $(DELETEOBJS)
  178. X    $(CC) $(LDFLAGS) $(CFLAGS) -o delete $(DELETEOBJS) $(LIBS)
  179. X
  180. Xsaber_delete:
  181. X    #setopt program_name delete
  182. X    #load $(LDFLAGS) $(CFLAGS) $(DELETESRC) $(LIBS)
  183. X
  184. Xlint_delete: $(DELETESRC)
  185. X    $(LINT) $(LINTFLAGS) $(DELETESRC) $(LINTLIBS)
  186. X
  187. Xundelete: $(UNDELETEOBJS)
  188. X    $(CC) $(LDFLAGS) $(CFLAGS) -o undelete $(UNDELETEOBJS) $(LIBS)
  189. X
  190. Xsaber_undelete:
  191. X    #setopt program_name undelete
  192. X    #load $(LDFLAGS) $(CFLAGS) $(UNDELETESRC) $(LIBS)
  193. X
  194. Xlint_undelete: $(UNDELETESRC)
  195. X    $(LINT) $(LINTFLAGS) $(UNDELETESRC) $(LINTLIBS)
  196. X
  197. Xexpunge: $(EXPUNGEOBJS)
  198. X    $(CC) $(LDFLAGS) $(CFLAGS) -o expunge $(EXPUNGEOBJS) $(LIBS)
  199. X
  200. Xsaber_expunge:
  201. X    #setopt program_name expunge
  202. X    #load $(LDFLAGS) $(CFLAGS) $(EXPUNGESRC) $(LIBS)
  203. X
  204. Xlint_expunge: $(EXPUNGESRC)
  205. X    $(LINT) $(LINTFLAGS) $(EXPUNGESRC) $(LINTLIBS)
  206. X
  207. Xpurge: expunge
  208. X    ln -s expunge purge
  209. X
  210. Xlsdel: $(LSDELOBJS)
  211. X    $(CC) $(LDFLAGS) $(CFLAGS) -o lsdel $(LSDELOBJS) $(LIBS)
  212. X
  213. Xlint_lsdel: $(LSDELSRC)
  214. X    $(LINT) $(LINTFLAGS) $(LSDELSRC) $(LINTLIBS)
  215. X
  216. Xsaber_lsdel:
  217. X    #setopt program_name lsdel
  218. X    #load $(LDFLAGS) $(CFLAGS) $(LSDELSRC) $(LIBS)
  219. X
  220. Xtar: $(ARCHIVE)
  221. X    tar cvf - $(ARCHIVE) $(ETLIBSRCS) | compress > delete.tar.Z
  222. X
  223. Xshar: $(ARCHIVE)
  224. X    makekit -oMANIFEST -h2 MANIFEST $(ARCHIVEDIRS) $(ARCHIVE) $(ETLIBSRCS)
  225. X
  226. Xpatch: $(ARCHIVE)
  227. X    makepatch $(ARCHIVE)
  228. X    mv patch delete.patch`cat PATCHLEVEL`
  229. X    shar delete.patch`cat PATCHLEVEL` > delete.patch`cat PATCHLEVEL`.shar
  230. X
  231. Xclean:
  232. X    -rm -f *~ *.bak *.o delete undelete lsdel expunge purge\
  233. X        delete_errs.h delete_errs.c
  234. X
  235. Xdepend: $(SRCS) $(INCS) $(ETS)
  236. X    /usr/athena/makedepend -v $(CFLAGS) -s'# DO NOT DELETE' $(SRCS)
  237. X
  238. X$(DELETEOBJS): delete_errs.h
  239. X$(EXPUNGEOBJS): delete_errs.h
  240. X$(UNDELETEOBJS): delete_errs.h
  241. X$(LSDELOBJS): delete_errs.h
  242. X
  243. X# DO NOT DELETE THIS LINE -- makedepend depends on it
  244. END_OF_FILE
  245. if test 4803 -ne `wc -c <'Makefile'`; then
  246.     echo shar: \"'Makefile'\" unpacked with wrong size!
  247. fi
  248. # end of 'Makefile'
  249. fi
  250. if test -f 'PATCHLEVEL' -a "${1}" != "-c" ; then 
  251.   echo shar: Will not clobber existing file \"'PATCHLEVEL'\"
  252. else
  253. echo shar: Extracting \"'PATCHLEVEL'\" \(2 characters\)
  254. sed "s/^X//" >'PATCHLEVEL' <<'END_OF_FILE'
  255. X9
  256. END_OF_FILE
  257. if test 2 -ne `wc -c <'PATCHLEVEL'`; then
  258.     echo shar: \"'PATCHLEVEL'\" unpacked with wrong size!
  259. fi
  260. # end of 'PATCHLEVEL'
  261. fi
  262. if test -f 'README' -a "${1}" != "-c" ; then 
  263.   echo shar: Will not clobber existing file \"'README'\"
  264. else
  265. echo shar: Extracting \"'README'\" \(5067 characters\)
  266. sed "s/^X//" >'README' <<'END_OF_FILE'
  267. X                   OVERVIEW
  268. X
  269. XThis archive contains the sources for five programs (well, actually,
  270. Xfour, since one is a symbolic link):
  271. X
  272. X    delete
  273. X    undelete
  274. X    expunge
  275. X    purge
  276. X    lsdel
  277. X
  278. XThe programs were written at Project Athena in response to the problem
  279. Xwhich many novice Unix users have with accidentally deleting files
  280. Xthey didn't want to delete (Hell, I've done it :-).
  281. X
  282. X
  283. X             SUPPORTED PLATFORMS
  284. X
  285. XI've personally compiled these sources under 4.3BSD on VAXen and IBM
  286. XRT/PC's, under Mach on the NeXT Machine, under Ultrix on the
  287. XDECstation 3100, and under SunOS 4.0, and I assume they should compile
  288. Xwith minimal trouble on other architectures.  If you make it compile
  289. Xon another platform and you have to make changes, please send me
  290. Xpatches.
  291. X
  292. X
  293. X             WHAT YOU NEED TO DO
  294. X
  295. X1. Compile the com_err library (see below for more details) found in
  296. X   the sub-directory et, and install it if you want to (you'll have to
  297. X   modify the delete Makefile a bit if you don't).
  298. X
  299. X2. Edit the Makefile to fit your site.  See below for details.
  300. X
  301. X3. Compile away!  Type "make" to make without installing, or "make
  302. X   install" to install binaries and man pages in the locations you
  303. X   specified when you edited the Makefile.
  304. X
  305. X
  306. X               CUSTOMIZING THE MAKEFILE
  307. X
  308. XYou are probably going to have to do one or more of the following to
  309. Xmake the Makefile work for you.
  310. X
  311. X1. Change the install binary directory and install man page directory
  312. X   (and possibly man section).
  313. X
  314. X2. Change the "-I/usr/include" to point to the et subdirectory if you
  315. X   have not installed the com_err header file in a standard location,
  316. X   or to wherever you have installed it.  Change the COMPILE_ET
  317. X   variable to use et/compile_et if you haven't installed the
  318. X   compile_et utility.  Change the -L/usr/athena/lib flag to point to
  319. X   wherever you have installed the library, or to the et subdirectory
  320. X   if you have not.
  321. X
  322. X3. Deal with the AFS_MOUNTPOINTS flag, which specifies whether
  323. X   undelete, expunge and lsdel will check for Andrew File System mount
  324. X   points in addition to standard Unix mount points.
  325. X
  326. X   a. If you undefine it, remove the -I and -L flags that point to AFS
  327. X      includes and libraries, and remove the "-lsys" from the LIBS
  328. X      variable.
  329. X
  330. X   b. If you leave it defined, change the -I and -L flags to point to
  331. X      wherever you keep your AFS includes and libraries.
  332. X
  333. X
  334. X               COM_ERR LIBRARY
  335. X
  336. XThis is the second release of this package.  Unlike the first release,
  337. Xthis release requires (for error-handling) a library called com_err,
  338. Xwhich was written by members of the MIT Student Information Processing
  339. XBoard (SIPB).  Along with that library comes a utility called
  340. Xcompile_et.  The sources to the com_err library and compile_et are
  341. Xincluded with the sources to the delete package; you should compile
  342. Xthem and then either install them in a "standard location" on your
  343. Xmachine or modify the delete Makefile so that it knows where they are.
  344. XThe delete Makefile does not compile them by default, since they are
  345. Xalready compiled and installed at Athena, so you should compile and
  346. Xinstall them separately from delete etc.
  347. X
  348. XThe files texinfo.tex and com_err.texinfo in the et sources are
  349. Xcompressed and uuencoded because they have control characters in them.
  350. XThey have to be uudecoded and uncompressed before using them.  Neither
  351. Xof them is necessary for just building the library and using it to
  352. Xbuild delete et al -- they are just documentation about the library.
  353. X
  354. XThe version of the com_err library I've included here is "in flux" --
  355. Xits authors tell me that several enhancements are planned for the near
  356. Xfuture.  When the library is worked into a more final form, it will
  357. Xprobably be distributed (to comp.sources.unix, etc.) separately from
  358. Xdelete.
  359. X
  360. X
  361. X                 FINAL NOTES
  362. X
  363. XThe final patch level used for the first release of this package was
  364. Xpatch level 2.  Since this is a whole new release, and there were some
  365. Xunofficial patches here and there during the life of the first
  366. Xrelease, I upped the patch level to 5 for the first distribution of
  367. Xthe second release of the delete package.
  368. X
  369. XThere were NO REAL PATCHES numbered 3, 4, or 5 -- I simply chose to
  370. Xjump from 2 to 5 when issuing a new release.  Therefore, if you have
  371. Xdelete sources with a patch level less than 5, you will need to get a
  372. Xwhole new copy of the sources.
  373. X
  374. XIn other words, treat patch level 5 as patch level 0 for all intents
  375. Xand purposes (gee, tha sounds stupid, but you get the idea :-).  See
  376. Xthe file PATCHLEVEL in the sources to find out what patch level of the
  377. Xsources you currently have in your position (if you're reading this
  378. XREADME file out of a source distribution, you almost definitely have
  379. Xpatch level 6 or later).
  380. X
  381. XAs usual, suggestions and bug fixes are always welcomed.
  382. X
  383. XMy address:
  384. X
  385. XJonathan Kamens                          USnail:
  386. XMIT Project Athena                11 Ashford Terrace
  387. Xjik@Athena.MIT.EDU                Allston, MA  02134
  388. XOffice: 617-253-8495                  Home: 617-782-0710
  389. X
  390. XP.S. Please see the file "mit-copyright.h" for copying and
  391. Xredistribution information.  Copyright 1989 Massachusetts Institute of
  392. XTechnology.  All Rights Reserved.  Etc.
  393. END_OF_FILE
  394. if test 5067 -ne `wc -c <'README'`; then
  395.     echo shar: \"'README'\" unpacked with wrong size!
  396. fi
  397. # end of 'README'
  398. fi
  399. if test -f 'col.h' -a "${1}" != "-c" ; then 
  400.   echo shar: Will not clobber existing file \"'col.h'\"
  401. else
  402. echo shar: Extracting \"'col.h'\" \(1507 characters\)
  403. sed "s/^X//" >'col.h' <<'END_OF_FILE'
  404. X/*
  405. X * $Source: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/col.h,v $
  406. X * $Author: jik $
  407. X *
  408. X * This header file is part of a package including delete, undelete,
  409. X * lsdel, expunge and purge.  The software suite is meant as a
  410. X * replacement for rm which allows for file recovery.
  411. X * 
  412. X * Copyright (c) 1989 by the Massachusetts Institute of Technology.
  413. X * For copying and distribution information, see the file "mit-copyright.h."
  414. X */
  415. X#include "mit-copyright.h"
  416. X
  417. X/*
  418. X * DEF_COL_WIDTH: the column with to try to use if none is specified.
  419. X * DEF_WAIT: 1 if the program is supposed to wait for stdin to get to
  420. X *           end-of-file and then print out everything in order in
  421. X *           columns by default.  If this is 0, then the default is
  422. X *           for the program to print across instead of down and to
  423. X *           print as it receives input from stdin.
  424. X * DEF_VAR_COLS: if 1, use variable-width columns based on text width.
  425. X *               if 1, DEF_WAIT must be true.
  426. X * DEF_SCR_WIDTH: default screen width
  427. X * DEF_NUM_ITEMS: if 1, number each item
  428. X * DEF_MARGIN: the default margin in between columns of text
  429. X */ 
  430. X#define DEF_COL_WIDTH 20
  431. X#define DEF_WAIT 1
  432. X#define DEF_VAR_COLS 1
  433. X#define DEF_SCR_WIDTH 80
  434. X#define DEF_NUM_ITEMS 1
  435. X#define DEF_MARGIN 2
  436. X /* This is used for when we need a guess as to how long a number will */
  437. X /* be when printed.  Also, if we are supposed to work in wait mode    */
  438. X /* and are not given a maxitems value, this is what is used.          */
  439. X#define DEF_MAX_ITEMS 10000
  440. END_OF_FILE
  441. if test 1507 -ne `wc -c <'col.h'`; then
  442.     echo shar: \"'col.h'\" unpacked with wrong size!
  443. fi
  444. # end of 'col.h'
  445. fi
  446. if test -f 'delete.h' -a "${1}" != "-c" ; then 
  447.   echo shar: Will not clobber existing file \"'delete.h'\"
  448. else
  449. echo shar: Extracting \"'delete.h'\" \(557 characters\)
  450. sed "s/^X//" >'delete.h' <<'END_OF_FILE'
  451. X/*
  452. X * $Source: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/delete.h,v $
  453. X * $Author: jik $
  454. X * $Header: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/delete.h,v 1.4 89/10/23 13:43:22 jik Exp $
  455. X * 
  456. X * This file is part of a package including delete, undelete,
  457. X * lsdel, expunge and purge.  The software suite is meant as a
  458. X * replacement for rm which allows for file recovery.
  459. X * 
  460. X * Copyright (c) 1989 by the Massachusetts Institute of Technology.
  461. X * For copying and distribution information, see the file "mit-copyright.h."
  462. X */
  463. X
  464. X#include "mit-copyright.h"
  465. END_OF_FILE
  466. if test 557 -ne `wc -c <'delete.h'`; then
  467.     echo shar: \"'delete.h'\" unpacked with wrong size!
  468. fi
  469. # end of 'delete.h'
  470. fi
  471. if test -f 'delete_errs.et' -a "${1}" != "-c" ; then 
  472.   echo shar: Will not clobber existing file \"'delete_errs.et'\"
  473. else
  474. echo shar: Extracting \"'delete_errs.et'\" \(1551 characters\)
  475. sed "s/^X//" >'delete_errs.et' <<'END_OF_FILE'
  476. X#     Copyright 1988 Massachusetts Institute of Technology.
  477. X#
  478. X#     For copying and distribution information, see the file
  479. X#     "mit-copyright.h".
  480. X#
  481. X#     $Source: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/delete_errs.et,v $
  482. X#     $Author: jik $
  483. X#     $Header: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/delete_errs.et,v 1.3 89/12/28 14:44:22 jik Exp $
  484. X#
  485. X
  486. X    et    del
  487. X
  488. Xec REGEXP_MISSING_QUOTED_CHAR,
  489. X    "missing quoted character after backslash"
  490. Xec REGEXP_MISSING_BRACE,
  491. X    "missing ]"
  492. Xec REGEXP_EMPTY_BRACES,
  493. X    "illegal empty braces"
  494. Xec DIR_NOT_DIRECTORY,
  495. X    "internal error: directory operation on non-directory"
  496. Xec DIR_IMPOSSIBLE_ERROR,
  497. X    "interal error: something that shouldn't happen just did"
  498. Xec COL_COLUMNS_TOO_THIN,
  499. X    "possible internal error: listing columns too thin"
  500. Xec DELETE_IS_DOTFILE,
  501. X    "can't delete `.' or `..'"
  502. Xec DELETE_CANT_DEL_DIR,
  503. X    "can't delete (not file)"
  504. Xec DELETE_DIR_NOT_EMPTY,
  505. X    "can't delete (directory not empty)"
  506. Xec DELETE_CANT_DEL_FILE,
  507. X    "can't delete (not directory)"
  508. Xec DELETE_NOT_DELETED,
  509. X    ""
  510. Xec UNDEL_NOT_UNDELETED,
  511. X    ""
  512. Xec NO_HOME_DIR,
  513. X    "can't find home directory"
  514. Xec INTERNAL_ERROR,
  515. X    "strange internal error"
  516. Xec ENOMATCH,
  517. X    "no match"
  518. Xec EXPUNGE_NOT_EXPUNGED,
  519. X    ""
  520. Xec PURGE_TOO_MANY_ARGS,
  521. X    "command takes no arguments"
  522. Xec PAT_NO_FILES_REQUESTED,
  523. X    "internal error: no files requested in call to find_matches or do_match"
  524. Xec PAT_IS_MOUNT,
  525. X    "ignored (is mount point)"
  526. Xec STACK_BAD_OP,
  527. X    "internal error: call to dostack with undefined stack operation"
  528. Xec STACK_EMPTY,
  529. X    "internal error: attempt to pop from empty stack"
  530. X
  531. X    end
  532. X
  533. END_OF_FILE
  534. if test 1551 -ne `wc -c <'delete_errs.et'`; then
  535.     echo shar: \"'delete_errs.et'\" unpacked with wrong size!
  536. fi
  537. # end of 'delete_errs.et'
  538. fi
  539. if test -f 'directories.h' -a "${1}" != "-c" ; then 
  540.   echo shar: Will not clobber existing file \"'directories.h'\"
  541. else
  542. echo shar: Extracting \"'directories.h'\" \(1542 characters\)
  543. sed "s/^X//" >'directories.h' <<'END_OF_FILE'
  544. X/*
  545. X * $Source: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/directories.h,v $
  546. X * $Author: jik $
  547. X * $Header: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/directories.h,v 1.8 89/11/06 19:54:20 jik Exp $
  548. X * 
  549. X * This file is part of a package including delete, undelete,
  550. X * lsdel, expunge and purge.  The software suite is meant as a
  551. X * replacement for rm which allows for file recovery.
  552. X * 
  553. X * Copyright (c) 1989 by the Massachusetts Institute of Technology.
  554. X * For copying and distribution information, see the file "mit-copyright.h."
  555. X */
  556. X
  557. X#include "mit-copyright.h"
  558. X
  559. Xtypedef short Boolean;
  560. X#define True            (Boolean) 1
  561. X#define False            (Boolean) 0
  562. X
  563. X
  564. X#define blk_to_k(x)        (x * DEV_BSIZE / 1024)
  565. X
  566. X#define FOLLOW_LINKS        1
  567. X#define DONT_FOLLOW_LINKS    0
  568. X
  569. X#define DIR_MATCH        1
  570. X#define DIR_NO_MATCH        0
  571. X     
  572. Xtypedef struct filrec {
  573. X     char name[MAXNAMLEN];
  574. X     struct filrec *previous;
  575. X     struct filrec *parent;
  576. X     struct filrec *dirs;
  577. X     struct filrec *files;
  578. X     struct filrec *next;
  579. X     Boolean specified;
  580. X     Boolean freed;
  581. X     struct stat specs;
  582. X} filerec;
  583. X
  584. X
  585. X
  586. Xint add_directory_to_parent();
  587. Xint add_file_to_parent();
  588. Xint add_path_to_tree();
  589. Xint find_child();
  590. Xfilerec *first_in_directory();
  591. Xfilerec *first_specified_in_directory();
  592. Xfilerec *get_cwd_tree();
  593. Xfilerec *get_root_tree();
  594. Xfilerec *next_directory();
  595. Xfilerec *next_in_directory();
  596. Xfilerec *next_leaf();
  597. Xfilerec *next_specified_directory();
  598. Xfilerec *next_specified_in_directory();
  599. Xfilerec *next_specified_leaf();
  600. X
  601. Xint get_leaf_path();
  602. Xint accumulate_names();
  603. X
  604. Xvoid free_leaf();
  605. END_OF_FILE
  606. if test 1542 -ne `wc -c <'directories.h'`; then
  607.     echo shar: \"'directories.h'\" unpacked with wrong size!
  608. fi
  609. # end of 'directories.h'
  610. fi
  611. if test -f 'errors.c' -a "${1}" != "-c" ; then 
  612.   echo shar: Will not clobber existing file \"'errors.c'\"
  613. else
  614. echo shar: Extracting \"'errors.c'\" \(1495 characters\)
  615. sed "s/^X//" >'errors.c' <<'END_OF_FILE'
  616. X/*
  617. X * $Source: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/errors.c,v $
  618. X * $Author: jik $
  619. X *
  620. X * This program is part of a package including delete, undelete,
  621. X * lsdel, expunge and purge.  The software suite is meant as a
  622. X * replacement for rm which allows for file recovery.
  623. X * 
  624. X * Copyright (c) 1989 by the Massachusetts Institute of Technology.
  625. X * For copying and distribution information, see the file "mit-copyright.h."
  626. X */
  627. X
  628. X#if (!defined(lint) && !defined(SABER))
  629. X     static char rcsid_errors_c[] = "$Header: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/errors.c,v 1.2 89/11/06 21:27:20 jik Exp $";
  630. X#endif
  631. X
  632. X#include <varargs.h>
  633. X#include <com_err.h>
  634. X#include <stdio.h>
  635. X#include "delete_errs.h"
  636. X#include "mit-copyright.h"
  637. X
  638. Xchar *whoami;
  639. Xint error_reported = 1;
  640. Xint error_occurred = 0;
  641. Xint report_errors = 1;
  642. Xint error_code = 0;
  643. X
  644. X/*
  645. X * Proper use of this procedure requires strict adherance to the way
  646. X * it is supposed to be used by all procedures in a program.  Whenever
  647. X * there is an error, set_error must be called with the error value.
  648. X * Then, either the procedure that detects the error must call
  649. X * error(), or it must pass the error up to its parent for the parent
  650. X * to report.
  651. X */
  652. X
  653. X
  654. Xvoid error(str)
  655. Xchar *str;
  656. X{
  657. X     if (report_errors && (! error_reported)) {
  658. X      if (*str)
  659. X           fprintf(stderr, "%s: %s: %s\n", whoami, str,
  660. X               error_message(error_code));
  661. X      else
  662. X           fprintf(stderr, "%s: %s\n", whoami, error_message(error_code));
  663. X     }
  664. X     error_reported = 1;
  665. X}
  666. END_OF_FILE
  667. if test 1495 -ne `wc -c <'errors.c'`; then
  668.     echo shar: \"'errors.c'\" unpacked with wrong size!
  669. fi
  670. # end of 'errors.c'
  671. fi
  672. if test -f 'errors.h' -a "${1}" != "-c" ; then 
  673.   echo shar: Will not clobber existing file \"'errors.h'\"
  674. else
  675. echo shar: Extracting \"'errors.h'\" \(883 characters\)
  676. sed "s/^X//" >'errors.h' <<'END_OF_FILE'
  677. X/*
  678. X * $Source: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/errors.h,v $
  679. X * $Author: jik $
  680. X * $Header: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/errors.h,v 1.2 89/11/06 21:27:23 jik Exp $
  681. X * 
  682. X * This file is part of a package including delete, undelete,
  683. X * lsdel, expunge and purge.  The software suite is meant as a
  684. X * replacement for rm which allows for file recovery.
  685. X * 
  686. X * Copyright (c) 1989 by the Massachusetts Institute of Technology.
  687. X * For copying and distribution information, see the file "mit-copyright.h."
  688. X */
  689. X#include "mit-copyright.h"
  690. X
  691. Xextern char *whoami;
  692. Xextern int error_reported;
  693. Xextern int error_occurred;
  694. Xextern int report_errors;
  695. Xextern int error_code;
  696. X
  697. Xvoid error();
  698. X
  699. X#define set_error(cd) {error_code = cd; error_reported = 0; error_occurred = 1;}
  700. X#define set_warning(cd) {error_code = cd; error_reported = 0;}
  701. X#define set_status(cd) {error_code = cd;}
  702. END_OF_FILE
  703. if test 883 -ne `wc -c <'errors.h'`; then
  704.     echo shar: \"'errors.h'\" unpacked with wrong size!
  705. fi
  706. # end of 'errors.h'
  707. fi
  708. if test -f 'expunge.h' -a "${1}" != "-c" ; then 
  709.   echo shar: Will not clobber existing file \"'expunge.h'\"
  710. else
  711. echo shar: Extracting \"'expunge.h'\" \(656 characters\)
  712. sed "s/^X//" >'expunge.h' <<'END_OF_FILE'
  713. X/*
  714. X * $Source: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/expunge.h,v $
  715. X * $Author: jik $
  716. X * $Header: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/expunge.h,v 1.4 89/10/23 13:37:05 jik Exp $
  717. X * 
  718. X * This file is part of a package including delete, undelete,
  719. X * lsdel, expunge and purge.  The software suite is meant as a
  720. X * replacement for rm which allows for file recovery.
  721. X * 
  722. X * Copyright (c) 1989 by the Massachusetts Institute of Technology.
  723. X * For copying and distribution information, see the file "mit-copyright.h."
  724. X */
  725. X#include "mit-copyright.h"
  726. X
  727. X#define ERROR_MASK        1
  728. X#define NO_DELETE_MASK        2
  729. X#define NO_TIMEOUT_MASK        4
  730. X
  731. Xint get_the_files();
  732. END_OF_FILE
  733. if test 656 -ne `wc -c <'expunge.h'`; then
  734.     echo shar: \"'expunge.h'\" unpacked with wrong size!
  735. fi
  736. # end of 'expunge.h'
  737. fi
  738. if test -f 'lsdel.h' -a "${1}" != "-c" ; then 
  739.   echo shar: Will not clobber existing file \"'lsdel.h'\"
  740. else
  741. echo shar: Extracting \"'lsdel.h'\" \(623 characters\)
  742. sed "s/^X//" >'lsdel.h' <<'END_OF_FILE'
  743. X/*
  744. X * $Source: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/lsdel.h,v $
  745. X * $Author: jik $
  746. X * $Header: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/lsdel.h,v 1.4 89/10/23 13:33:51 jik Exp $
  747. X * 
  748. X * This file is part of a package including delete, undelete,
  749. X * lsdel, expunge and purge.  The software suite is meant as a
  750. X * replacement for rm which allows for file recovery.
  751. X * 
  752. X * Copyright (c) 1989 by the Massachusetts Institute of Technology.
  753. X * For copying and distribution information, see the file "mit-copyright.h."
  754. X */
  755. X#include "mit-copyright.h"
  756. X
  757. X#define ERROR_MASK 1
  758. X#define NO_DELETE_MASK 2
  759. X
  760. Xint get_the_files();
  761. END_OF_FILE
  762. if test 623 -ne `wc -c <'lsdel.h'`; then
  763.     echo shar: \"'lsdel.h'\" unpacked with wrong size!
  764. fi
  765. # end of 'lsdel.h'
  766. fi
  767. if test ! -d 'man1' ; then
  768.     echo shar: Creating directory \"'man1'\"
  769.     mkdir 'man1'
  770. fi
  771. if test -f 'man1/delete.1' -a "${1}" != "-c" ; then 
  772.   echo shar: Will not clobber existing file \"'man1/delete.1'\"
  773. else
  774. echo shar: Extracting \"'man1/delete.1'\" \(4217 characters\)
  775. sed "s/^X//" >'man1/delete.1' <<'END_OF_FILE'
  776. X.\"    $Source: /afs/athena.mit.edu/user/j/jik/src/delete/man1/RCS/delete.1,v $
  777. X.\"    $Author: jik $
  778. X.\"    $Header: /afs/athena.mit.edu/user/j/jik/src/delete/man1/RCS/delete.1,v 1.5 89/09/14 03:42:51 jik Exp $
  779. X.\"
  780. X.\" Copyright 1989 by the Massachusetts Institute of Technology.  All
  781. X.\" rights reserved.  The file /usr/include/mit-copyright.h specifies
  782. X.\" the terms and conditions for redistribution.
  783. X.\"
  784. X.\"
  785. X.TH DELETE 1 "January 26, 1988" "MIT Project Athena"
  786. X.ds ]W MIT Project Athena
  787. X.SH NAME
  788. Xdelete \- a recoverable file-deletion utility
  789. X.SH SYNOPSIS
  790. X.B delete
  791. X[
  792. X.B \-r
  793. X] [
  794. X.B \-i
  795. X] [
  796. X.B \-f
  797. X] [
  798. X.B \-n
  799. X] [
  800. X.B \-v
  801. X] [
  802. X.B \-e
  803. X] [
  804. X.B \-F
  805. X] [
  806. X.B \-D
  807. X] [
  808. X.B \-\|\-
  809. X] filename ...
  810. X.PP
  811. X.SH DESCRIPTION
  812. X.I Delete
  813. Xmarks files and directories for later permanent removal (by renaming
  814. Xthem with a prefix of \fI.#\fR).  Files accidentally marked for deletion
  815. Xcan be recovered using
  816. X.I undelete(1).
  817. XMarked files are periodically
  818. Xremoved automatically by the system; they can also be removed on demand
  819. X(see \fIpurge\fR(1) and \fIexpunge\fR(1) for details).
  820. XUsers can list files which have been marked for
  821. Xremoval but have not yet been removed using \fIlsdel\fR(1).
  822. X.PP
  823. XIf the user does not have write permission to a file, its permissions
  824. Xare printed and the user is asked whether the file should be removed.
  825. XIf the first character of the response line is \fIy\fR the file is
  826. Xremoved, otherwise it remains.
  827. X.PP
  828. XUsers wishing to retain the user interface of \fIrm\fR(1)
  829. Xand \fIrmdir\fR(1)
  830. Xwhile still being able to recover accidentally removed files can do so
  831. Xby aliasing
  832. X.I rm
  833. Xto
  834. X.I delete \-F \-e
  835. Xand
  836. X.I rmdir
  837. Xto
  838. X.I delete \-D \-e
  839. X(see below).
  840. X.SH OPTIONS
  841. X.I Delete
  842. Xaccepts the following command-line options:
  843. X.TP
  844. X.B \-r
  845. XIf a designated filename is a non-empty directory,
  846. X.I delete
  847. Xwill signal an error unless the
  848. X.B \-r
  849. Xoption is specified.  In that case,
  850. X.I delete
  851. Xrecursively deletes the directory's entire contents and the directory
  852. Xitself.  If the
  853. X.B \-F
  854. Xoption is specified (see below),
  855. X.I delete
  856. Xwill signal an error even if the directory is empty.
  857. X.TP
  858. X.B \-i
  859. XCauses
  860. X.I delete
  861. Xto ask whether to delete each file, and, in recursive
  862. Xmode, whether to examine each directory.
  863. X.TP
  864. X.B \-f
  865. XPrevents
  866. X.I delete
  867. Xfrom asking any questions and from reporting any errors.
  868. X.TP
  869. X.B \-n
  870. XNo file removals are performed.  Instead,
  871. X.I delete
  872. Xprints to the standard output the files that it would remove were the
  873. X.B \-n
  874. Xoption not specified.
  875. X.TP
  876. X.B \-v
  877. XCauses
  878. X.I delete
  879. Xto report each file as it is deleted.
  880. X.TP
  881. X.B \-e
  882. XCauses
  883. X.I delete
  884. Xto emulate \fIrm\fR(1) and \fIrmdir\fR(1) as much as it can (i.e.
  885. Xerror and status messages and other peculiarities of \fIrm\fR(1) and
  886. X\fIrmdir\fI(1)).
  887. X.TP
  888. X.B \-F
  889. XCauses
  890. X.I delete
  891. Xto emulate
  892. X.I rm
  893. Xby preventing it from removing even empty directories when the
  894. X.B \-r
  895. Xoption is not specified.
  896. X.TP
  897. X.B \-D
  898. XCauses
  899. X.I delete
  900. Xto emulate
  901. X.I rmdir
  902. Xby preventing it from removing anything but empty directories.
  903. X.TP
  904. X.B \-\|\-
  905. XTwo dashes indicate that all the arguments following it are to be treated as
  906. Xfile names, even if they start with a dash.
  907. X.SH "SEE ALSO"
  908. Xundelete(1), purge(1), expunge(1), lsdel(1), rm(1), rmdir(1)
  909. X.SH AUTHOR
  910. XJonathan I. Kamens (MIT-Project Athena)
  911. X.SH COPYRIGHT
  912. XCopyright (c) 1989 by the Massachusetts Institute of Technology.
  913. X.PP
  914. XAll rights reserved.
  915. X.PP
  916. XPermission to use, copy, modify, and distribute this software and its
  917. Xdocumentation for any purpose and without fee is hereby granted,
  918. Xprovided that the above copyright notice appear in all copies and that
  919. Xboth that copyright notice and this permission notice appear in
  920. Xsupporting documentation, and that the name of the Massachusetts
  921. XInstitute of Technology (M.I.T.) not be used in advertising or publicity
  922. Xpertaining to distribution of the software without specific, written
  923. Xprior permission.
  924. X.PP
  925. XM.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  926. XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  927. XM.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  928. XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  929. XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  930. XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  931. XSOFTWARE.
  932. X
  933. X
  934. END_OF_FILE
  935. if test 4217 -ne `wc -c <'man1/delete.1'`; then
  936.     echo shar: \"'man1/delete.1'\" unpacked with wrong size!
  937. fi
  938. # end of 'man1/delete.1'
  939. fi
  940. if test -f 'man1/expunge.1' -a "${1}" != "-c" ; then 
  941.   echo shar: Will not clobber existing file \"'man1/expunge.1'\"
  942. else
  943. echo shar: Extracting \"'man1/expunge.1'\" \(4062 characters\)
  944. sed "s/^X//" >'man1/expunge.1' <<'END_OF_FILE'
  945. X.\"    $Source: /afs/athena.mit.edu/user/j/jik/src/delete/man1/RCS/expunge.1,v $
  946. X.\"    $Author: jik $
  947. X.\"    $Header: /afs/athena.mit.edu/user/j/jik/src/delete/man1/RCS/expunge.1,v 1.6 89/11/02 07:10:08 jik Exp $
  948. X.\"
  949. X.\" Copyright 1989 by the Massachusetts Institute of Technology.  All
  950. X.\" rights reserved.  The file /usr/include/mit-copyright.h specifies
  951. X.\" the terms and conditions for redistribution.
  952. X.\"
  953. X.\"
  954. X.TH EXPUNGE 1 "January 27, 1988" "MIT Project Athena"
  955. X.ds ]W MIT Project Athena
  956. X.SH NAME
  957. Xexpunge, purge \- permanent removal of \fIdelete\fR\^d files
  958. X.SH SYNOPSIS
  959. X.B expunge
  960. X[
  961. X.B \-r
  962. X] [
  963. X.B \-i
  964. X] [
  965. X.B \-f
  966. X] [
  967. X.B \-t \fIn\fR
  968. X] [
  969. X.B \-n
  970. X] [
  971. X.B \-v
  972. X] [
  973. X.B \-l
  974. X] [
  975. X.B \-s
  976. X] [
  977. X.B \-m
  978. X] [
  979. X.B \-y
  980. X] [
  981. X.B \-\|\-
  982. X] [ filename [ ... ]]
  983. X.PP
  984. X.B purge
  985. X.PP
  986. X.SH DESCRIPTION
  987. X.I Expunge
  988. Xand
  989. X.I purge
  990. Xpermanently remove files which have been marked for deletion using
  991. X\fIdelete\fR(1).  Files removed with \fIexpunge\fR or \fIpurge\fR
  992. Xcannot be recovered, and care should therefore be exercised in the
  993. Xuse of these utilities.
  994. X.PP
  995. X.I Purge
  996. Xis a simple utility which takes no command-line arguments.  When it is
  997. Xexecuted, it searches through the user's entire home directory and
  998. Xfinds all files that have been marked for deletion.  It then displays
  999. Xa list of the files where are to be removed and prompts for
  1000. Xconfirmation.  A response from the user starting with the letter
  1001. X\fIy\fR will cause the files to be permanently expunged.
  1002. X.PP
  1003. XBecause
  1004. X.I purge
  1005. Xsearches through the user's entire home directory, it can take quite a
  1006. Xwhile to complete its search.  This is normal.
  1007. X.PP
  1008. XThe filenames passed to
  1009. X.I expunge
  1010. Xon the command-line can be directories (deleted or not deleted) or
  1011. Xdeleted files.  Deleted files or directories are always completely
  1012. Xexpunged, while the treatment of non-deleted directories depends on
  1013. Xthe
  1014. X.BR \-r
  1015. Xcommand-line option (see below).  If no command-line filenames are
  1016. Xspecified,
  1017. X.I expunge
  1018. Xdefaults to the current working directory.
  1019. X.PP
  1020. XFor information about wildcard use with \fIexpunge\fR, please see
  1021. X\fIundelete\fR(1).
  1022. X.PP
  1023. X.SH OPTIONS
  1024. X.I Expunge
  1025. Xaccepts the following command-line options:
  1026. X.TP
  1027. X.B \-r
  1028. XWhen a non-deleted directory is passed to \fIexpunge\fR, the 
  1029. X.BR \-r
  1030. Xoption causes the directory to be searced recursively for deleted
  1031. Xfiles.  If the recursive option is \fInot\fR specified, only the
  1032. Xdirect children of the non-deleted directory are examined.  A
  1033. Xrecursive search of a large directory can take quite a while.
  1034. X.TP
  1035. X.B \-i
  1036. XThe user is prompted for confirmation with the name of the file and
  1037. Xits size in kilobytes before each file or directory is
  1038. Xremoved.
  1039. X.TP
  1040. X.B \-f
  1041. XUsed in conjunction with the
  1042. X.BR \-l
  1043. Xoption, this option prevents 
  1044. X.I expunge
  1045. Xfrom prompting for confirmation after listing all the files that are
  1046. Xtoo be deleted.  Furthermore, it prevents the printing of error
  1047. Xmessages.
  1048. X.TP
  1049. X.B \-t\fIn\fR
  1050. XSpecifies the minimum age (in days) of files to be expunged, measured
  1051. Xas the length of time since the last file modification.
  1052. X.TP
  1053. X.B \-n
  1054. XNo file expunges are performed.  Instead,
  1055. X.I expunge
  1056. Xprints to the standard output the files that it would expunge were the
  1057. X.BR \-n
  1058. Xoption not specified.
  1059. X.TP
  1060. X.B \-v
  1061. XCauses 
  1062. X.I expunge
  1063. Xto report each file as it is expunged, as well as the size of the file
  1064. Xand a running total of the number of kilobytes expunged.
  1065. X.TP
  1066. X.B \-l
  1067. XCauses 
  1068. X.I expunge
  1069. Xto list all found files before expunging them, similar to the actions
  1070. Xof
  1071. X.I purge.
  1072. X.TP
  1073. X.B \-s
  1074. XSymbolic links are followed when searching for deleted files.
  1075. X.TP
  1076. X.B \-m
  1077. XMount points are followed when searching for deleted files.
  1078. X.TP
  1079. X.B \-y
  1080. XThe total number of kilobytes expunged is printed after
  1081. X.I expunge
  1082. Xis finished removing files.
  1083. X.TP
  1084. X.B \-\|\-
  1085. XTwo dashes indicate that all arguments following it are to be treated
  1086. Xas file names, even if they start with a dash.
  1087. X.SH "SEE ALSO"
  1088. Xdelete(1), undelete(1), lsdel(1), rm(1), rmdir(1)
  1089. X.SH AUTHOR
  1090. XJonathan I. Kamens (MIT-Project Athena)
  1091. X.SH RESTRICTIONS
  1092. XCopyright (c) 1989 by the Massachusetts Institute of Technology.  All
  1093. Xrights reserved.
  1094. X.IR Delete (1)
  1095. Xspecifies the terms and conditions for redistribution.
  1096. END_OF_FILE
  1097. if test 4062 -ne `wc -c <'man1/expunge.1'`; then
  1098.     echo shar: \"'man1/expunge.1'\" unpacked with wrong size!
  1099. fi
  1100. # end of 'man1/expunge.1'
  1101. fi
  1102. if test -f 'man1/lsdel.1' -a "${1}" != "-c" ; then 
  1103.   echo shar: Will not clobber existing file \"'man1/lsdel.1'\"
  1104. else
  1105. echo shar: Extracting \"'man1/lsdel.1'\" \(2152 characters\)
  1106. sed "s/^X//" >'man1/lsdel.1' <<'END_OF_FILE'
  1107. X.\"    $Source: /afs/athena.mit.edu/user/j/jik/src/delete/man1/RCS/lsdel.1,v $
  1108. X.\"    $Author: jik $
  1109. X.\"    $Header: /afs/athena.mit.edu/user/j/jik/src/delete/man1/RCS/lsdel.1,v 1.5 89/11/02 07:12:21 jik Exp $
  1110. X.\"
  1111. X.\" Copyright 1989 by the Massachusetts Institute of Technology.  All
  1112. X.\" rights reserved.  The file /usr/include/mit-copyright.h specifies
  1113. X.\" the terms and conditions for redistribution.
  1114. X.\"
  1115. X.\"
  1116. X.TH LSDEL 1 "January 27, 1988" "MIT Project Athena"
  1117. X.ds ]W MIT Project Athena
  1118. X.SH NAME
  1119. Xlsdel \- list deleted files
  1120. X.SH SYNOPSIS
  1121. X.B lsdel
  1122. X[
  1123. X.B \-d
  1124. X] [
  1125. X.B \-r
  1126. X] [
  1127. X.B \-t \fIn\fR
  1128. X] [
  1129. X.B \-s
  1130. X] [
  1131. X.B \-m
  1132. X] [
  1133. X.B \-y
  1134. X] [ filename [ ... ]]
  1135. X.PP
  1136. X.SH DESCRIPTION
  1137. X.I Lsdel
  1138. Xlists files that have been marked for deletion by the \fIdelete\fR(1)
  1139. Xprogram.
  1140. X.PP
  1141. XFor information about using wildcards with \fIlsdel\fR, see
  1142. X\fIundelete\fR(1).
  1143. X.PP
  1144. XFilenames passed to \fIlsdel\fR can be directories (non-deleted or
  1145. Xdeleted) or deleted files.  If a non-deleted directory is specified,
  1146. Xlsdel lists the deleted contents of that directory.  If the
  1147. X.BR \-r
  1148. Xoption is specified, all non-deleted children of the directory will be
  1149. Xsearched recursively for deleted files.  If no command-line filenames
  1150. Xare specified,
  1151. X.I lsdel
  1152. Xdefaults to the current working directory.
  1153. X.PP
  1154. X.I Lsdel
  1155. Xrecursively lists deleted directories by default.  This can be
  1156. Xdisabled with the
  1157. X.BR \-d
  1158. Xoption, which causes directory names, rather than their contents, to
  1159. Xbe listed.
  1160. X.PP
  1161. XThe
  1162. X.BR \-t
  1163. Xoption allows the user to specify a minimum age, in days, of files to
  1164. Xlist.  Only files that have not been modified in \fIn\fR days or more
  1165. Xwill be listed.
  1166. X.PP
  1167. XThe
  1168. X.BR \-s
  1169. Xoptions tells
  1170. X.I lsdel
  1171. Xto follow symbolic links when searching for deleted files.  The
  1172. X.BR \-m
  1173. Xoption does the same thing for mount points.
  1174. X.PP
  1175. XThe
  1176. X.BR \-y
  1177. Xoption causes
  1178. X.I lsdel
  1179. Xto print the total amount of space taken up by all the files it lists.
  1180. X.SH "SEE ALSO"
  1181. Xdelete(1), undelete(1), purge(1), expunge(1), ls(1)
  1182. X.SH AUTHOR
  1183. XJonathan I. Kamens (MIT-Project Athena)
  1184. X.SH RESTRICTIONS
  1185. XCopyright (c) 1989 by the Massachusetts Institute of Technology.  All
  1186. Xrights reserved.
  1187. X.IR Delete (1)
  1188. Xspecifies the terms and conditions for redistribution.
  1189. END_OF_FILE
  1190. if test 2152 -ne `wc -c <'man1/lsdel.1'`; then
  1191.     echo shar: \"'man1/lsdel.1'\" unpacked with wrong size!
  1192. fi
  1193. # end of 'man1/lsdel.1'
  1194. fi
  1195. if test -f 'man1/purge.1' -a "${1}" != "-c" ; then 
  1196.   echo shar: Will not clobber existing file \"'man1/purge.1'\"
  1197. else
  1198. echo shar: Extracting \"'man1/purge.1'\" \(421 characters\)
  1199. sed "s/^X//" >'man1/purge.1' <<'END_OF_FILE'
  1200. X.\"    $Source: /afs/athena.mit.edu/user/j/jik/src/delete/man1/RCS/purge.1,v $
  1201. X.\"    $Author: jik $
  1202. X.\"    $Header: /afs/athena.mit.edu/user/j/jik/src/delete/man1/RCS/purge.1,v 1.1 89/01/27 04:50:13 jik Exp $
  1203. X.\"
  1204. X.\" Copyright 1989 by the Massachusetts Institute of Technology.  All
  1205. X.\" rights reserved.  The file /usr/include/mit-copyright.h specifies
  1206. X.\" the terms and conditions for redistribution.
  1207. X.\"
  1208. X.\"
  1209. X.so man1/expunge.1
  1210. END_OF_FILE
  1211. if test 421 -ne `wc -c <'man1/purge.1'`; then
  1212.     echo shar: \"'man1/purge.1'\" unpacked with wrong size!
  1213. fi
  1214. # end of 'man1/purge.1'
  1215. fi
  1216. if test -f 'man1/undelete.1' -a "${1}" != "-c" ; then 
  1217.   echo shar: Will not clobber existing file \"'man1/undelete.1'\"
  1218. else
  1219. echo shar: Extracting \"'man1/undelete.1'\" \(3506 characters\)
  1220. sed "s/^X//" >'man1/undelete.1' <<'END_OF_FILE'
  1221. X.\"    $Source: /afs/athena.mit.edu/user/j/jik/src/delete/man1/RCS/undelete.1,v $
  1222. X.\"    $Author: jik $
  1223. X.\"    $Header: /afs/athena.mit.edu/user/j/jik/src/delete/man1/RCS/undelete.1,v 1.5 89/11/02 07:13:26 jik Exp $
  1224. X.\" Copyright 1989 by the Massachusetts Institute of Technology.  All
  1225. X.\" rights reserved.  The file /usr/include/mit-copyright.h specifies
  1226. X.\" the terms and conditions for redistribution.
  1227. X.\"
  1228. X.\"
  1229. X.TH UNDELETE 1 "January 26, 1988" "MIT Project Athena"
  1230. X.ds ]W MIT Project Athena
  1231. X.SH NAME
  1232. Xundelete \- recover files removed by delete
  1233. X.SH SYNOPSIS
  1234. X.B undelete
  1235. X[
  1236. X.B \-r
  1237. X] [
  1238. X.B \-i
  1239. X] [
  1240. X.B \-f
  1241. X] [
  1242. X.B \-v
  1243. X] [
  1244. X.B \-n
  1245. X] [
  1246. X.B \-R
  1247. X] [
  1248. X.B \-\|\-
  1249. X] [ filename [ ... ]]
  1250. X.PP
  1251. X.DESCRIPTION
  1252. X.I Undelete
  1253. Xrecovers files and directories that have been marked for permanent removal by 
  1254. X\fIdelete\fR(1), but have not
  1255. Xyet been removed.
  1256. X.PP
  1257. XFilenames passed to
  1258. X.I undelete
  1259. Xcan be directories or deleted files.
  1260. XIf a directory that is not deleted is passed to
  1261. X.I undelete,
  1262. Xthen the deleted files or directories in it will be restored; if the
  1263. Xrecursive option is specified, then all deleted files or directories
  1264. Xin any of its children will be restored as well.
  1265. X.PP
  1266. XThe shell wildcards \fI*\fR and \fI?\fR, as well as shell brace
  1267. Xnotation using \fI[\fR and \fI]\fR, are interpreted correctly by
  1268. X.I undelete.
  1269. XIt is possible to pass wildcards to the program without the wildcards
  1270. Xbeing intercepted by the shell by setting
  1271. X.I noglob
  1272. X(in \fIcsh\fR) or by quoting the wildcards.  To delete a file that
  1273. Xactually has a wildcard in its name, you must precede the quoted
  1274. Xwildcard with a quoted backslash.
  1275. X.PP
  1276. XIf no files are specified on the command line,
  1277. X.I undelete
  1278. Xgoes into interactive mode.  In interactive mode, the user is prompted
  1279. Xto enter files to be restored, one file per line.  Typing a carriage
  1280. Xreturn on an empty prompt line exits the program.
  1281. X.PP
  1282. XWildcards and quoting backslashes can be entered directly at the
  1283. Xprompt without any shell interference (which is the
  1284. Xmain reason there is an interactive mode).
  1285. X.SH OPTIONS
  1286. X.I Undelete
  1287. Xaccepts the following command-line options:
  1288. X.TP
  1289. X.B \-r
  1290. XIf a specified file is a directory, the directory and all of its
  1291. Xchildren are restored recursively.
  1292. X.TP
  1293. X.B \-i
  1294. XThe user is prompted for confirmation before each file or directory is
  1295. Xrestored.  This is not the same as the interactive file name entry
  1296. Xmode which is automatically activated when no files are specified on
  1297. Xthe command line.
  1298. X.TP
  1299. X.B \-f
  1300. XPrevents
  1301. X.I undelete
  1302. Xfrom reporting errors.  Further, if an intact (undeleted) version of a
  1303. Xfile which is requested for undeletion exists, then
  1304. X.I undelete
  1305. Xwill not prompt for confirmation before overwriting the undeleted file
  1306. Xwith the recovered one.
  1307. X.TP
  1308. X.B \-v
  1309. XCauses
  1310. X.I undelete
  1311. Xto report each file as it is restored.  Also, causes an introductory
  1312. Xmessage to be printed when entering interactive mode.
  1313. X.TP
  1314. X.B \-n
  1315. XNo file recoveries are performed.  Instead,
  1316. X.I undelete
  1317. Xprints to the standard output the files that it would recover were the
  1318. X.B \-n
  1319. Xoption not specified.
  1320. X.TP
  1321. X.B \-R
  1322. XPrevents
  1323. X.I undelete
  1324. Xfrom restoring the contents of directories in any case.
  1325. X.TP
  1326. X.B \-\|\-
  1327. XTwo dashes indicate that all arguments following it are to be treated as file
  1328. Xnames, even if they start with a dash.
  1329. X.SH "SEE ALSO"
  1330. Xdelete(1), purge(1), expunge(1), lsdel(1), rm(1), rmdir(1)
  1331. X.SH AUTHOR
  1332. XJonathan I. Kamens (MIT-Project Athena)
  1333. X.SH RESTRICTIONS
  1334. XCopyright (c) 1989 by the Massachusetts Institute of Technology.  All
  1335. Xrights reserved.
  1336. X.IR Delete (1)
  1337. Xspecifies the terms and conditions for redistribution.
  1338. END_OF_FILE
  1339. if test 3506 -ne `wc -c <'man1/undelete.1'`; then
  1340.     echo shar: \"'man1/undelete.1'\" unpacked with wrong size!
  1341. fi
  1342. # end of 'man1/undelete.1'
  1343. fi
  1344. if test -f 'mit-copyright.h' -a "${1}" != "-c" ; then 
  1345.   echo shar: Will not clobber existing file \"'mit-copyright.h'\"
  1346. else
  1347. echo shar: Extracting \"'mit-copyright.h'\" \(1025 characters\)
  1348. sed "s/^X//" >'mit-copyright.h' <<'END_OF_FILE'
  1349. X/*
  1350. X
  1351. XCopyright 1987,1988 by the Massachusetts Institute of Technology
  1352. X
  1353. XAll rights reserved.
  1354. X
  1355. XPermission to use, copy, modify, and distribute this software and its
  1356. Xdocumentation for any purpose and without fee is hereby granted,
  1357. Xprovided that the above copyright notice appear in all copies and that
  1358. Xboth that copyright notice and this permission notice appear in
  1359. Xsupporting documentation, and that the name of the Massachusetts
  1360. XInstitute of Technology (M.I.T.) not be used in advertising or publicity
  1361. Xpertaining to distribution of the software without specific, written
  1362. Xprior permission.
  1363. X
  1364. XM.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  1365. XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  1366. XM.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  1367. XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  1368. XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  1369. XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  1370. XSOFTWARE.
  1371. X
  1372. X*/
  1373. END_OF_FILE
  1374. if test 1025 -ne `wc -c <'mit-copyright.h'`; then
  1375.     echo shar: \"'mit-copyright.h'\" unpacked with wrong size!
  1376. fi
  1377. # end of 'mit-copyright.h'
  1378. fi
  1379. if test -f 'pattern.h' -a "${1}" != "-c" ; then 
  1380.   echo shar: Will not clobber existing file \"'pattern.h'\"
  1381. else
  1382. echo shar: Extracting \"'pattern.h'\" \(1199 characters\)
  1383. sed "s/^X//" >'pattern.h' <<'END_OF_FILE'
  1384. X/*
  1385. X * $Source: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/pattern.h,v $
  1386. X * $Author: jik $
  1387. X * $Header: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/pattern.h,v 1.5 89/11/06 19:54:32 jik Exp $
  1388. X * 
  1389. X * This program is part of a package including delete, undelete,
  1390. X * lsdel, expunge and purge.  The software suite is meant as a
  1391. X * replacement for rm which allows for file recovery.
  1392. X * 
  1393. X * Copyright (c) 1989 by the Massachusetts Institute of Technology.
  1394. X * For copying and distribution information, see the file "mit-copyright.h."
  1395. X */
  1396. X#include "mit-copyright.h"
  1397. X
  1398. Xint add_str();
  1399. Xint add_arrays();
  1400. Xint find_contents();
  1401. Xint find_deleted_contents();
  1402. Xint find_deleted_contents_recurs();
  1403. Xint find_matches();
  1404. Xint find_deleted_matches();
  1405. Xint find_recurses();
  1406. Xint find_deleted_recurses();
  1407. X
  1408. X#define FIND_DELETED        (1<<0)
  1409. X#define FIND_UNDELETED        (1<<1)
  1410. X#define RECURS_FIND_DELETED    (1<<2)
  1411. X#define RECURS_FIND_UNDELETED    (1<<3)
  1412. X#define RECURS_DELETED        (1<<4)
  1413. X#define FOLLW_LINKS        (1<<5)
  1414. X#define FOLLW_MOUNTPOINTS    (1<<6)
  1415. X#define FIND_DOTFILES        (1<<7)
  1416. X#define FIND_CONTENTS        (1<<8)
  1417. X#define SUPPRESS_WARNINGS    (1<<9)
  1418. X#define RECURS            (RECURS_FIND_DELETED | RECURS_FIND_UNDELETED |\
  1419. X                 RECURS_DELETED | FIND_CONTENTS)
  1420. END_OF_FILE
  1421. if test 1199 -ne `wc -c <'pattern.h'`; then
  1422.     echo shar: \"'pattern.h'\" unpacked with wrong size!
  1423. fi
  1424. # end of 'pattern.h'
  1425. fi
  1426. if test -f 'shell_regexp.c' -a "${1}" != "-c" ; then 
  1427.   echo shar: Will not clobber existing file \"'shell_regexp.c'\"
  1428. else
  1429. echo shar: Extracting \"'shell_regexp.c'\" \(3189 characters\)
  1430. sed "s/^X//" >'shell_regexp.c' <<'END_OF_FILE'
  1431. X/*
  1432. X * $Source: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/shell_regexp.c,v $
  1433. X * $Author: jik $
  1434. X *
  1435. X * This program is part of a package including delete, undelete,
  1436. X * lsdel, expunge and purge.  The software suite is meant as a
  1437. X * replacement for rm which allows for file recovery.
  1438. X * 
  1439. X * Copyright (c) 1989 by the Massachusetts Institute of Technology.
  1440. X * For copying and distribution information, see the file "mit-copyright.h."
  1441. X */
  1442. X
  1443. X#if (!defined(lint) && !defined(SABER))
  1444. X     static char rcsid_shell_regexp_c[] = "$Header: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/shell_regexp.c,v 1.2 89/11/06 21:27:16 jik Exp $";
  1445. X#endif
  1446. X
  1447. X#include <com_err.h>
  1448. X#include "shell_regexp.h"
  1449. X#include "delete_errs.h"
  1450. X#include "errors.h"
  1451. X#include "mit-copyright.h"
  1452. X
  1453. Xstatic int real_cmp();
  1454. X
  1455. X/*
  1456. X * This is a simple pattern matcher that takes a pattern string and
  1457. X * another string (theoretically a filename) and checks if the second
  1458. X * string matches the pattern string using shell special characters
  1459. X * (i.e. it recognizes \, ?, *, [, ]).  It also special cases dot
  1460. X * files (i.e. * doesn't match files that start with periods, and
  1461. X * neither will ?*, and neither will [.]*).
  1462. X */
  1463. X
  1464. Xint reg_cmp(pattern, filename)
  1465. Xchar *pattern, *filename;
  1466. X{
  1467. X     /* First, dot file special cases */
  1468. X     if ((*filename == '.') && (*pattern != '.'))
  1469. X      return REGEXP_NO_MATCH;
  1470. X
  1471. X     return real_cmp(pattern, filename);
  1472. X}
  1473. X
  1474. Xstatic int real_cmp(pattern, filename)
  1475. Xchar *pattern, *filename;
  1476. X{
  1477. X     if (*pattern == '\0') {
  1478. X      if (*filename == '\0')
  1479. X           return REGEXP_MATCH;
  1480. X      else
  1481. X           return REGEXP_NO_MATCH;
  1482. X     }
  1483. X     
  1484. X     if (*pattern == '*') {
  1485. X      int retval;
  1486. X      char *ptr;
  1487. X      
  1488. X      if (*(pattern + 1) == '\0')
  1489. X           /* asterisk by itself matches anything */
  1490. X           return REGEXP_MATCH;
  1491. X      for (ptr = filename; *ptr; ptr++)
  1492. X           if ((retval = real_cmp(pattern + 1, ptr)) != REGEXP_NO_MATCH)
  1493. X            return retval;
  1494. X      return REGEXP_NO_MATCH;
  1495. X     }
  1496. X
  1497. X     if (*filename == '\0')
  1498. X      return REGEXP_NO_MATCH;
  1499. X     
  1500. X     if (*pattern == '?')
  1501. X      return real_cmp(pattern + 1, filename + 1);
  1502. X
  1503. X     if (*pattern == '\\') {
  1504. X      if (*(pattern + 1) == '\0') {
  1505. X           set_error(REGEXP_MISSING_QUOTED_CHAR);
  1506. X           return -1;
  1507. X      }
  1508. X      if (*(pattern + 1) == *filename)
  1509. X           return real_cmp(pattern + 2, filename + 1);
  1510. X      else
  1511. X           return REGEXP_NO_MATCH;
  1512. X     }
  1513. X
  1514. X     if (*pattern == '[') {
  1515. X      char *ptr, *end_ptr;
  1516. X
  1517. X      for (end_ptr = pattern + 1; (*end_ptr != '\0') && (*end_ptr != ']');
  1518. X           end_ptr++) ;
  1519. X      if (*end_ptr == '\0') {
  1520. X           set_error(REGEXP_MISSING_BRACE);
  1521. X           return -1;
  1522. X      }
  1523. X      if (end_ptr == pattern + 1) {
  1524. X           set_error(REGEXP_EMPTY_BRACES);
  1525. X           return -1;
  1526. X      }
  1527. X      for (ptr = pattern + 1; ptr < end_ptr; ptr++) {
  1528. X           if ((*(ptr + 1) == '-') && (*(ptr + 2) != ']')) {
  1529. X            if ((*ptr <= *filename) && (*(ptr + 2) >= *filename))
  1530. X             return real_cmp(end_ptr + 1, filename + 1);
  1531. X            else {
  1532. X             ptr += 2;
  1533. X             continue;
  1534. X            }
  1535. X           }
  1536. X           if (*ptr == *filename)
  1537. X            return real_cmp(end_ptr + 1, filename + 1);
  1538. X      }
  1539. X
  1540. X      return REGEXP_NO_MATCH;
  1541. X     }
  1542. X            
  1543. X     if (*pattern == *filename)
  1544. X      return real_cmp(pattern + 1, filename + 1);
  1545. X     else
  1546. X      return REGEXP_NO_MATCH;
  1547. X}
  1548. END_OF_FILE
  1549. if test 3189 -ne `wc -c <'shell_regexp.c'`; then
  1550.     echo shar: \"'shell_regexp.c'\" unpacked with wrong size!
  1551. fi
  1552. # end of 'shell_regexp.c'
  1553. fi
  1554. if test -f 'shell_regexp.h' -a "${1}" != "-c" ; then 
  1555.   echo shar: Will not clobber existing file \"'shell_regexp.h'\"
  1556. else
  1557. echo shar: Extracting \"'shell_regexp.h'\" \(536 characters\)
  1558. sed "s/^X//" >'shell_regexp.h' <<'END_OF_FILE'
  1559. X/*
  1560. X * $Source: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/shell_regexp.h,v $
  1561. X * $Author: jik $
  1562. X *
  1563. X * This program is part of a package including delete, undelete,
  1564. X * lsdel, expunge and purge.  The software suite is meant as a
  1565. X * replacement for rm which allows for file recovery.
  1566. X * 
  1567. X * Copyright (c) 1989 by the Massachusetts Institute of Technology.
  1568. X * For copying and distribution information, see the file "mit-copyright.h."
  1569. X */
  1570. X#include "mit-copyright.h"
  1571. X
  1572. Xextern int reg_cmp();
  1573. X
  1574. X#define REGEXP_MATCH 1
  1575. X#define REGEXP_NO_MATCH 0
  1576. END_OF_FILE
  1577. if test 536 -ne `wc -c <'shell_regexp.h'`; then
  1578.     echo shar: \"'shell_regexp.h'\" unpacked with wrong size!
  1579. fi
  1580. # end of 'shell_regexp.h'
  1581. fi
  1582. if test -f 'stack.c' -a "${1}" != "-c" ; then 
  1583.   echo shar: Will not clobber existing file \"'stack.c'\"
  1584. else
  1585. echo shar: Extracting \"'stack.c'\" \(2320 characters\)
  1586. sed "s/^X//" >'stack.c' <<'END_OF_FILE'
  1587. X/*
  1588. X * $Source: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/stack.c,v $
  1589. X * $Author: jik $
  1590. X *
  1591. X * This program is part of a package including delete, undelete,
  1592. X * lsdel, expunge and purge.  The software suite is meant as a
  1593. X * replacement for rm which allows for file recovery.
  1594. X * 
  1595. X * Copyright (c) 1989 by the Massachusetts Institute of Technology.
  1596. X * For copying and distribution information, see the file "mit-copyright.h."
  1597. X */
  1598. X
  1599. X#if (!defined(lint) && !defined(SABER))
  1600. X     static char rcsid_stack_c[] = "$Header: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/stack.c,v 1.5 89/12/11 03:32:37 jik Exp $";
  1601. X#endif
  1602. X
  1603. X#include <sys/types.h>
  1604. X#include <stdio.h>
  1605. X#include <errno.h>
  1606. X#include "stack.h"
  1607. X#include "delete_errs.h"
  1608. X#include "errors.h"
  1609. X#include "mit-copyright.h"
  1610. X#include "util.h"
  1611. X
  1612. Xextern char *realloc();
  1613. Xextern int errno;
  1614. X
  1615. X#define STACK_INC     25
  1616. X
  1617. X
  1618. X
  1619. Xint dostack(data, op, bytes)
  1620. Xcaddr_t data;
  1621. Xint op, bytes;
  1622. X{
  1623. X     static caddr_t stack = (caddr_t) NULL;
  1624. X     static int size = 0, count = 0;
  1625. X
  1626. X     switch (op) {
  1627. X     case EMPTY_STACK:
  1628. X      if (size) {
  1629. X           free(stack);
  1630. X           stack = (caddr_t) NULL;
  1631. X           size = count = 0;
  1632. X      }
  1633. X      return 0;
  1634. X     case STACK_PUSH:
  1635. X      if (bytes == 0)
  1636. X           return 0;
  1637. X      if (size - count < bytes) {
  1638. X           do
  1639. X            size += STACK_INC;
  1640. X           while (size - count < bytes);
  1641. X           stack = (caddr_t) (stack ? realloc((char *) stack,
  1642. X                          (unsigned) size) :
  1643. X                  Malloc((unsigned) size));
  1644. X           if (! stack) {
  1645. X            size = count = 0;
  1646. X            set_error(errno);
  1647. X            error("Malloc");
  1648. X            return error_code;
  1649. X           }
  1650. X      }
  1651. X      bcopy(data, stack + count, bytes);
  1652. X      count += bytes;
  1653. X      return 0;
  1654. X     case STACK_POP:
  1655. X      if (bytes == 0)
  1656. X           return 0;
  1657. X      if (count == 0) {
  1658. X           set_status(STACK_EMPTY);
  1659. X           return error_code;
  1660. X      }
  1661. X      else {
  1662. X           int newblocks, newsize;
  1663. X
  1664. X           count -= bytes;
  1665. X           bcopy(stack + count, data, bytes);
  1666. X           newblocks = count / STACK_INC + ((count % STACK_INC) ? 1 : 0);
  1667. X           newsize = newblocks * STACK_INC;
  1668. X           if (newsize < size) {
  1669. X            size = newsize;
  1670. X            stack = (caddr_t) realloc((char *) stack, (unsigned) size);
  1671. X            if (! stack) {
  1672. X             set_error(errno);
  1673. X             error("realloc");
  1674. X             return error_code;
  1675. X            }
  1676. X           }
  1677. X           return 0;
  1678. X      }
  1679. X     default:
  1680. X      set_error(STACK_BAD_OP);
  1681. X      return error_code;
  1682. X     }
  1683. X}
  1684. END_OF_FILE
  1685. if test 2320 -ne `wc -c <'stack.c'`; then
  1686.     echo shar: \"'stack.c'\" unpacked with wrong size!
  1687. fi
  1688. # end of 'stack.c'
  1689. fi
  1690. if test -f 'stack.h' -a "${1}" != "-c" ; then 
  1691.   echo shar: Will not clobber existing file \"'stack.h'\"
  1692. else
  1693. echo shar: Extracting \"'stack.h'\" \(817 characters\)
  1694. sed "s/^X//" >'stack.h' <<'END_OF_FILE'
  1695. X/*
  1696. X * $Source: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/stack.h,v $
  1697. X * $Author: jik $
  1698. X * $Header: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/stack.h,v 1.2 89/11/06 21:26:50 jik Exp $
  1699. X * 
  1700. X * This file is part of a package including delete, undelete,
  1701. X * lsdel, expunge and purge.  The software suite is meant as a
  1702. X * replacement for rm which allows for file recovery.
  1703. X * 
  1704. X * Copyright (c) 1989 by the Massachusetts Institute of Technology.
  1705. X * For copying and distribution information, see the file "mit-copyright.h."
  1706. X */
  1707. X#include "mit-copyright.h"
  1708. X
  1709. X#define STACK_PUSH     0
  1710. X#define STACK_POP    1
  1711. X#define EMPTY_STACK    2
  1712. X
  1713. X#define push(data, size)    dostack((caddr_t) data, STACK_PUSH, size)
  1714. X#define pop(data, size)        dostack((caddr_t) data, STACK_POP, size)
  1715. X#define popall()        dostack((caddr_t) NULL, EMPTY_STACK, 0)
  1716. X     
  1717. END_OF_FILE
  1718. if test 817 -ne `wc -c <'stack.h'`; then
  1719.     echo shar: \"'stack.h'\" unpacked with wrong size!
  1720. fi
  1721. # end of 'stack.h'
  1722. fi
  1723. if test -f 'undelete.h' -a "${1}" != "-c" ; then 
  1724.   echo shar: Will not clobber existing file \"'undelete.h'\"
  1725. else
  1726. echo shar: Extracting \"'undelete.h'\" \(748 characters\)
  1727. sed "s/^X//" >'undelete.h' <<'END_OF_FILE'
  1728. X/*
  1729. X * $Source: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/undelete.h,v $
  1730. X * $Author: jik $
  1731. X * $Header: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/undelete.h,v 1.4 89/10/23 13:09:09 jik Exp $
  1732. X * 
  1733. X * This program is part of a package including delete, undelete,
  1734. X * lsdel, expunge and purge.  The software suite is meant as a
  1735. X * replacement for rm which allows for file recovery.
  1736. X * 
  1737. X * Copyright (c) 1989 by the Massachusetts Institute of Technology.
  1738. X * For copying and distribution information, see the file "mit-copyright.h."
  1739. X */
  1740. X#include "mit-copyright.h"
  1741. X
  1742. X#define DELETEPREFIX ".#"
  1743. X#define DELETEREPREFIX "\\.#"
  1744. X
  1745. Xtypedef struct {
  1746. X     char *user_name;
  1747. X     char *real_name;
  1748. X} listrec;
  1749. X
  1750. Xint sort_files();
  1751. Xint unique();
  1752. X
  1753. Xint get_the_files();
  1754. END_OF_FILE
  1755. if test 748 -ne `wc -c <'undelete.h'`; then
  1756.     echo shar: \"'undelete.h'\" unpacked with wrong size!
  1757. fi
  1758. # end of 'undelete.h'
  1759. fi
  1760. if test -f 'util.h' -a "${1}" != "-c" ; then 
  1761.   echo shar: Will not clobber existing file \"'util.h'\"
  1762. else
  1763. echo shar: Extracting \"'util.h'\" \(1149 characters\)
  1764. sed "s/^X//" >'util.h' <<'END_OF_FILE'
  1765. X/*
  1766. X * $Source: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/util.h,v $
  1767. X * $Author: jik $
  1768. X * $Header: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/util.h,v 1.10 90/01/11 03:44:53 jik Exp $
  1769. X * 
  1770. X * This file is part of a package including delete, undelete,
  1771. X * lsdel, expunge and purge.  The software suite is meant as a
  1772. X * replacement for rm which allows for file recovery.
  1773. X * 
  1774. X * Copyright (c) 1989 by the Massachusetts Institute of Technology.
  1775. X * For copying and distribution information, see the file "mit-copyright.h."
  1776. X */
  1777. X#include "mit-copyright.h"
  1778. X
  1779. Xchar *append();
  1780. Xchar *convert_to_user_name();
  1781. Xchar *firstpart();
  1782. Xchar *lastpart();
  1783. Xchar *strindex();
  1784. Xchar *strrindex();
  1785. X#ifdef MALLOC_DEBUG
  1786. Xchar *Malloc();
  1787. X#else
  1788. X#define Malloc(a) malloc(a)
  1789. Xextern char *malloc();
  1790. X#endif
  1791. X
  1792. Xint is_mountpoint(), is_link();
  1793. X
  1794. X#define is_dotfile(A) ((*A == '.') && \
  1795. X               ((*(A + 1) == '\0') || \
  1796. X            ((*(A + 1) == '.') && \
  1797. X             (*(A + 2) == '\0'))))
  1798. X
  1799. X#define is_deleted(A) ((*A == '.') && (*(A + 1) == '#'))
  1800. X
  1801. X /* It would be BAD to pass something with a ++ anywhere near it into */
  1802. X /* this macro!                               */
  1803. X#define Opendir(dir) opendir(*(dir) ? (dir) : ".")
  1804. END_OF_FILE
  1805. if test 1149 -ne `wc -c <'util.h'`; then
  1806.     echo shar: \"'util.h'\" unpacked with wrong size!
  1807. fi
  1808. # end of 'util.h'
  1809. fi
  1810. echo shar: End of archive 1 \(of 3\).
  1811. cp /dev/null ark1isdone
  1812. MISSING=""
  1813. for I in 1 2 3 ; do
  1814.     if test ! -f ark${I}isdone ; then
  1815.     MISSING="${MISSING} ${I}"
  1816.     fi
  1817. done
  1818. if test "${MISSING}" = "" ; then
  1819.     echo You have unpacked all 3 archives.
  1820.     rm -f ark[1-9]isdone
  1821. else
  1822.     echo You still need to unpack the following archives:
  1823.     echo "        " ${MISSING}
  1824. fi
  1825. ##  End of shell archive.
  1826. exit 0
  1827. exit 0 # Just in case...
  1828.